package srp

import (
    `io`
    `fmt`
)

// 责任与变革

// CalculatorV1 calculates the test coverage for a directory and it's sub-directories
// CaltualVv1计算目录和它的子目录的测试覆盖率
type CalculatorV1 struct {
    // coverage data populated by  `Calculate()` method
    // 用“计算”（）方法填充的覆盖数据
    data map[string]float64
}

// cacluate will  calculate the coverage
func (c *CalculatorV1) Calculate(path string) error {

    // run `go test -cover ./[path]/...` and store the results
    return nil
}

// Output will print the coverage data to the supplied writer

func (c *CalculatorV1) Output(writer io.Writer) {
    for path, result := range c.data {
        fmt.Fprintf(writer, "%s -> %.1f\n", path, result)
    }

}
